<%-- ** mmdb_option **
-UI for refined search
-able to distinguish between categories chosen from drop-down
and display appropriate content
-has links to return to simple search and reset refined search
-implements forms for each search category, 
with each having search fields specific to that category
--%>

<%@page import="javax.servlet.http.*"%>

<HTML>
	<HEAD>
		<TITLE>Multimedia Database: Refined Search </TITLE>
	</HEAD>
	
	<BODY>
		<H1>Multimedia Database: Refined Search</H1>
		
		<!-- uses query string to determine chosen search category -->
		<%String qs = request.getQueryString();%>
		
		<!-- if query string is null (i.e. not specified), lets the user choose the search category -->
		<%if (qs == null) {%>
			<h3>Select a search category and more search options will appear.</h3>
		
			<SELECT NAME="category">
					<OPTION>-</OPTION>
					<OPTION ONCLICK="window.location.href='http://localhost:8080/mmdb_option.jsp?person';">Person</OPTION>
					<OPTION ONCLICK="window.location.href='http://localhost:8080/mmdb_option.jsp?movie';">Movie</OPTION>
					<OPTION ONCLICK="window.location.href='http://localhost:8080/mmdb_option.jsp?tv';">TV Show</OPTION>
					<OPTION ONCLICK="window.location.href='http://localhost:8080/mmdb_option.jsp?radio';">Radio Show</OPTION>
					<OPTION ONCLICK="window.location.href='http://localhost:8080/mmdb_option.jsp?character';">Character</OPTION>
					<OPTION ONCLICK="window.location.href='http://localhost:8080/mmdb_option.jsp?studio';">Studio</OPTION>
					<OPTION ONCLICK="window.location.href='http://localhost:8080/mmdb_option.jsp?award';">Award</OPTION>
			</SELECT>
		<!-- each of the following "else if" statements handles the various search categories and displays the appropriate search fields, -->
		<!-- again using the query string to tell the results page which category it will be dealing with -->
		<%}
		else if (qs.equals("person")) {%>
			<H2>Category: Person</H2>
			<H3>
				Enter search terms into any of the following fields
				and click search to find people with matching information.
			</H3>
			
			<FORM NAME="person_search" ACTION="mmdb_result.jsp?person" METHOD="POST">
				Name: <INPUT TYPE="TEXT" SIZE=50 NAME="name"> <BR><BR>
				Year of Birth: <INPUT TYPE="TEXT" SIZE=50 NAME="yrBorn"> <BR><BR>
				Year of Death: <INPUT TYPE="TEXT" SIZE=50 NAME="yrDied"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>
		<%}
		else if (qs.equals("movie")) {%>
			<H2>Category: Movie</H2>
			<H3>
				Enter search terms into any of the following fields
				and click search to find movies with matching information.
			</H3>
			
			<FORM NAME="movie_search" ACTION="mmdb_result.jsp?movie" METHOD="POST">
				Title: <INPUT TYPE="TEXT" SIZE=50 NAME="title"> <BR><BR>
				Year Made: <INPUT TYPE="TEXT" SIZE=50 NAME="yrMade"> <BR><BR>
				Language: <INPUT TYPE="TEXT" SIZE=50 NAME="language"> <BR><BR>
				Directed by: <INPUT TYPE="TEXT" SIZE=50 NAME="director"> <BR><BR>
				Written by: <INPUT TYPE="TEXT" SIZE=50 NAME="writer"> <BR><BR>
				Produced by: <INPUT TYPE="TEXT" SIZE=50 NAME="producer"> <BR><BR>
				Financed by (studio): <INPUT TYPE="TEXT" SIZE=50 NAME="studio"> <BR><BR>
				Had actor: <INPUT TYPE="TEXT" SIZE=50 NAME="actor"> <BR><BR>
				Had character: <INPUT TYPE="TEXT" SIZE=50 NAME="character"> <BR><BR>
				Won award: <INPUT TYPE="TEXT" SIZE=50 NAME="award"> <BR><BR>
				Had Profits: <INPUT TYPE="TEXT" SIZE=50 NAME="profits"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>
		<%}
		else if (qs.equals("tv")) {%>
			<H2>Category: TV Show</H2>
			<H3>
				Enter search terms into any of the following fields
				and click search to find TV shows with matching information.
			</H3>
			
			<FORM NAME="tv_search" ACTION="mmdb_result.jsp?tv" METHOD="POST">
				Title: <INPUT TYPE="TEXT" SIZE=50 NAME="title"> <BR><BR>
				Year Made: <INPUT TYPE="TEXT" SIZE=50 NAME="yrMade"> <BR><BR>
				Year Ended: <INPUT TYPE="TEXT" SIZE=50 NAME="yrEnded"> <BR><BR>
				Number of Seasons <INPUT TYPE="TEXT" SIZE=50 NAME="noSeasons"> <BR><BR>
				Network: <INPUT TYPE="TEXT" SIZE=50 NAME="network"> <BR><BR>
				Language: <INPUT TYPE="TEXT" SIZE=50 NAME="language"> <BR><BR>
				Directed by: <INPUT TYPE="TEXT" SIZE=50 NAME="director"> <BR><BR>
				Written by: <INPUT TYPE="TEXT" SIZE=50 NAME="writer"> <BR><BR>
				Produced by: <INPUT TYPE="TEXT" SIZE=50 NAME="producer"> <BR><BR>
				Financed by (studio): <INPUT TYPE="TEXT" SIZE=50 NAME="studio"> <BR><BR>
				Had actor: <INPUT TYPE="TEXT" SIZE=50 NAME="actor"> <BR><BR>
				Had character: <INPUT TYPE="TEXT" SIZE=50 NAME="character"> <BR><BR>
				Won award: <INPUT TYPE="TEXT" SIZE=50 NAME="award"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>	
		<%}
		else if (qs.equals("radio")) {%>
			<H2>Category: Radio Show</H2>
			<H3>
				Enter search terms into any of the following fields
				and click search to find radio shows with matching information.
			</H3>
			
			<FORM NAME="radio_search" ACTION="mmdb_result.jsp?radio" METHOD="POST">
				Title: <INPUT TYPE="TEXT" SIZE=50 NAME="title"> <BR><BR>
				Year Made: <INPUT TYPE="TEXT" SIZE=50 NAME="yrMade"> <BR><BR>
				Year Ended: <INPUT TYPE="TEXT" SIZE=50 NAME="yrEnded"> <BR><BR>
				Station: <INPUT TYPE="TEXT" SIZE=50 NAME="station"> <BR><BR>
				Language: <INPUT TYPE="TEXT" SIZE=50 NAME="language"> <BR><BR>
				Directed by: <INPUT TYPE="TEXT" SIZE=50 NAME="director"> <BR><BR>
				Written by: <INPUT TYPE="TEXT" SIZE=50 NAME="writer"> <BR><BR>
				Produced by: <INPUT TYPE="TEXT" SIZE=50 NAME="producer"> <BR><BR>
				Financed by (studio): <INPUT TYPE="TEXT" SIZE=50 NAME="studio"> <BR><BR>
				Had actor: <INPUT TYPE="TEXT" SIZE=50 NAME="actor"> <BR><BR>
				Had character: <INPUT TYPE="TEXT" SIZE=50 NAME="character"> <BR><BR>
				Won award: <INPUT TYPE="TEXT" SIZE=50 NAME="award"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>
		<%}
		else if (qs.equals("character")) {%>
			<H2>Category: Character</H2>
			<H3>
				Enter search terms into any of the following fields
				and click search to find characters with matching information.
			</H3>
			
			<FORM NAME="character_search" ACTION="mmdb_result.jsp?character" METHOD="POST">
				Role (character name): <INPUT TYPE="TEXT" SIZE=50 NAME="role"> <BR><BR>
				Actor: <INPUT TYPE="TEXT" SIZE=50 NAME="actor"> <BR><BR>
				Media: <INPUT TYPE="TEXT" SIZE=50 NAME="media"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>
		<%}
		else if (qs.equals("studio")) {%>
			<H2>Category: Studio</H2>
			<H3>
				Enter search terms into any of the following fields
				and click search to find studios with matching information.
			</H3>
			
			<FORM NAME="studio_search" ACTION="mmdb_result.jsp?studio" METHOD="POST">
				Name: <INPUT TYPE="TEXT" SIZE=50 NAME="name"> <BR><BR>
				Year Founded: <INPUT TYPE="TEXT" SIZE=50 NAME="yrFounded"> <BR><BR>
				Parent Studio: <INPUT TYPE="TEXT" SIZE=50 NAME="ownedBy"> <BR><BR>
				Owns (subsidiary studios): <INPUT TYPE="TEXT" SIZE=50 NAME="owns"> <BR><BR>
				Financed: <INPUT TYPE="TEXT" SIZE=50 NAME="financed"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>
		<%}
		else if (qs.equals("award")) {%>
			<H2>Category: Award</H2>
			<H3>
				Enter search terms into any of the following fields
				and click search to find awards with matching information.
			</H3>
			
			<FORM NAME="award_search" ACTION="mmdb_result.jsp?award" METHOD="POST">
				Name: <INPUT TYPE="TEXT" SIZE=50 NAME="name"> <BR><BR>
				Description: <INPUT TYPE="TEXT" SIZE=50 NAME="description"> <BR><BR>
				Year Won: <INPUT TYPE="TEXT" SIZE=50 NAME="yrWon"> <BR><BR>
				Person that won: <INPUT TYPE="TEXT" SIZE=50 NAME="pWinner"> <BR><BR>
				Movie that won: <INPUT TYPE="TEXT" SIZE=50 NAME="mWinner"> <BR><BR>
				<INPUT TYPE="SUBMIT" value="Submit">
			</FORM>
		<%}%>
		
		<BR><BR>
		
		<!-- links to navigate the site -->
		<table border="3"><tr>
		
		<%if (qs != null) {%>
			<td><a href="http://localhost:8080/mmdb_option.jsp">Start new refined search</a></td>
		<%}%>
		
		<td><a href="http://localhost:8080/mmdb_home.jsp">Return to simple search</a></td>
		<td><a href="http://localhost:8080/mmdb_complicated.jsp">Select a complicated query</a></td>
		</tr></table>
	</BODY>
</HTML>